﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using core;

namespace comix
{
    public class DeviceCollection:SiteItemMRCollection
    {
        public DeviceCollection()
        {
            m_insertcommand.CommandText = "INSERT USERDEVICES (usr_id, usr_device, usr_activation) VALUES (@usr_id, @usr_device, GetDate())";
            m_deletecommand.CommandText = "DELETE USERDEVICES WHERE usr_id = @usr_id AND usr_device =@usr_device";
        }

        public override ISiteItemMember CreateItem(System.Data.SqlClient.SqlDataReader rdr)
        {
            return new Device();
        }

        protected override void SetInsertParameters(SiteItemMain si)
        {
            Device d = (Device)si;
            m_insertcommand.Parameters.Clear();
            m_insertcommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@usr_id", d.usrid));
            m_insertcommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@usr_device", d.device));
        }

        protected override void SetRemoveParameters(SiteItemMain si)
        {
            Device d = (Device)si;
            m_insertcommand.Parameters.Clear();
            m_insertcommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@usr_id", d.usrid));
            m_insertcommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@usr_device", d.device));
        }

        protected override void SetSelectParameters()
        {
            
        }

        protected override void SetUpdateParameters(SiteItemMain si)
        {
           
        }
    }
}